<div class="bDiv" style="height: auto;">
    <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
        <table>
            <tbody>
            <volist name="goods" id="good" key="k" >
                <tr>
                    <td align="center" axis="col0">
                        <div style="width: 30px;">{$good.id}</div>
                    </td>
                    <td class="handle">
                        <div style="text-align:left;min-width:50px !important; max-width:inherit !important;">
                              <span class="btn">
                                  <em><i class="fa fa-cog"></i>设置<i class="arrow"></i></em>
                                  <ul>
                                      <li><a href="{:U('Good/edit', array('id'=> $good['id']))}">编辑</a></li>
                                      <li><a href="{:U('Good/price', array('id'=>$good['id']))}">代理价</a></li>
                                      <if condition="$good['end_shelves'] eq -1">
                                        <li><a href="{:U('Good/appeal', array('id'=>$good['id']))}">申诉</a></li>
                                      </if>
                                  </ul>
                              </span>
                        </div>
                    </td>
                    <td align="left" class="">
                        <div style="text-align: left; width: 40px;">
                            <if condition="$good['img'] neq ''">
                                <a href="{$good.img}" target="_blank">
                                    <img onMouseOver="$(this).attr('width','80').attr('height','45');" onMouseOut="$(this).attr('width','40').attr('height','30');" width="40" height="30" src="{$good.img}"/>
                                </a>
                            <else />
                                <a href="./Uploads/good/no.png" target="_blank">
                                    <img onMouseOver="$(this).attr('width','80').attr('height','45');" onMouseOut="$(this).attr('width','40').attr('height','30');" width="40" height="30" src="./Uploads/good/no.png"/>
                                </a>
                            </if>
                        </div>
                    </td>
                    <td align="center" axis="col0">
                        <div style="text-align: left; width: 120px;">{$good.g_name}</div>
                    </td>
                    <td align="center" axis="col0">
                        <div style="text-align: center; width: 80px;">{$good.good_sn}</div>
                    </td>
                    <td align="center" axis="col0">
                        <div style="text-align: center; width: 60px;">
                            {$good.stock}件
                        </div>
                    </td>
                    <td align="center" axis="col0">
                        <div style="text-align: center; width: 80px;">{$good.b_name}</div>
                    </td>
                    <td align="center" axis="col0">
                        <div style="text-align: center; width: 60px;">{$good.c_name}</div>
                    </td>
                    <td align="center" axis="col0">
                        <div style="text-align: center; width: 80px;">
                            <if condition="$good['end_shelves'] eq 1">
                                <span style="color: green;">已通过</span>
                            <else />
                                <span style="color: red;">已下架</span>
                            </if>
                        </div>
                    </td>
                    <td align="center" axis="col0">
                        <div style="text-align: center; width: 50px;">{$good.price}</div>
                    </td>
                    <td align="center" axis="col0">
                        <div style="text-align: center; width: 30px;">
                            <if condition='$good[recommend] eq 1'>
                                <span class="yes" onClick="changeGoodsVal2('good','id','{$good.id}','recommend',this)" ><i class="fa fa-check-circle"></i>是</span>
                                <else />
                                <span class="no" onClick="changeGoodsVal2('good','id','{$good.id}','recommend',this)" ><i class="fa fa-ban"></i>否</span>
                            </if>
                        </div>
                    </td>
                    <td align="center" axis="col0">
                        <div style="text-align: center; width: 30px;">
                            <if condition='$good[hot] eq 1'>
                                <span class="yes" onClick="changeGoodsVal2('good','id','{$good.id}','hot',this)" ><i class="fa fa-check-circle"></i>是</span>
                                <else />
                                <span class="no" onClick="changeGoodsVal2('good','id','{$good.id}','hot',this)" ><i class="fa fa-ban"></i>否</span>
                            </if>
                        </div>
                    </td>
                    <td align="center" axis="col0">
                        <div style="text-align: center; width: 30px;">
                            <if condition='$good[is_free] eq 1'>
                                <span class="yes" onClick="changeGoodsVal2('good','id','{$good.id}','is_free',this)" ><i class="fa fa-check-circle"></i>是</span>
                                <else />
                                <span class="no" onClick="changeGoodsVal2('good','id','{$good.id}','is_free',this)" ><i class="fa fa-ban"></i>否</span>
                            </if>
                        </div>
                    </td>
                    <td align="center" axis="col0">
                        <div style="text-align: center; width: 50px;">
                            <if condition='$good[shelves] eq 1'>
                                <span class="yes" onClick="changeGoodsVal2('good','id','{$good.id}','shelves',this)" ><i class="fa fa-check-circle"></i>是</span>
                                <else />
                                <span class="no" onClick="changeGoodsVal2('good','id','{$good.id}','shelves',this)" ><i class="fa fa-ban"></i>否</span>
                            </if>
                        </div>
                    </td>
                    <td align="" class="" style="width: 100%;">
                        <div>&nbsp;</div>
                    </td>
                </tr>
            </volist>
            </tbody>
        </table>
        {$page}
    </div>
</div>


<script type="text/javascript">
    $(document).ready(function(){

        //商品申诉弹出层
        $(".appeal").click(function() {
            layer.open({
                type: 1,
                title: '申诉理由',
                shadeClose: true,
                area: ['500px', '200px'],
                content:"<div style='width: 80%;margin: 10px auto;'><input type='hidden' value='' id='g_id'><textarea id='content_appel' style='width: 100%;height:60px;margin: 10px auto;'></textarea><div class='bot'><a href='JavaScript:void(0);' class='ncap-btn-big ncap-btn-green' id='submit_btn' >确认提交</a></div></div>"
            });
            var gid = $(this).attr('data-id');
            $('#g_id').attr('value', gid);
        });


        //提交商品申诉
        $('body').on('click', '#submit_btn', function() {
            var content = $.trim( $('#content_appel').val() );
            var good_id = $(this).attr('data-id');
            if (content != '') {
                $.ajax({
                    url: "{:U('Good/appeal')}",
                    type: 'post',
                    data: {
                        appeal_msg: content,
                        good_id: $('#g_id').val()
                    },
                    success: function(msg) {
                        if(msg == 1) {

                        }
                    }
                });
            } else {
                layer.msg('请填写申诉理由!', {icon:2, time:1000});
            }
        });



        // 刷选条件 鼠标 移动进去 移出 样式
        $(".hDivBox > table > thead > tr > th.mhover").mousemove(function(){
            $(this).addClass('thOver');
        }).mouseout(function(){
            $(this).removeClass('thOver');
        });

        $(".pagination a").click(function(){
            cur_page = $(this).data('p');
            ajax_get_table(cur_page);
        });
    });
</script>